package 尚硅谷juc大厂.test6;

import java.util.concurrent.locks.ReentrantLock;

public class Test6 {

    private ReentrantLock lock=new ReentrantLock();

    /**
     * lock悲观锁
     */
    public void lock(){
        lock.lock();
        try {

        }catch (Exception exception){

        }finally {
            lock.unlock();
        }
    }


    /**
     * synchronized悲观锁
     */
    public synchronized void sync(){

    }


}
